<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>邀请排行榜</title>
    <link rel="stylesheet" type="text/css" href="src/css/other.css?__version=3.4">
</head>
<body>
    <div class="init_content" style="display: none;">
        <div class="warp invitationrank-warp contentbg">
            <div class="invitationrank_content">
                <div class="banner"><img src="src/img/invitationrank.jpg?v=1"></div>
                <div class="invitationrank_activity">
                    <div class="bgtop"></div>
                    <div class="bgcenter">
                        <div class="invitationrank_activity_cont">
                            <div class="item">
                                <div class="title first">活动说明</div>
                                <div class="info">殿下邀请的好友，注册成功并登陆后，好友数+1成功邀请一名友好，邀请人可以获得30金币和一次抽奖机会!!!</div>
                            </div>
                            <div class="item">
                                <div class="title other">活动时间</div>
                                <div class="info">2018年2月5日- 2018年2月25日</div>
                            </div>
                            <div class="item">
                                <div class="title other">活动奖励</div>
                                <div class="info" style="line-height:30px;">累计邀请人数最高的前三名，直接领红包！<br/>第一名：奖励300元红包；<br/>第二名：奖励200元红包；<br/>第三名：奖励100元红包；<br/>特别奖励：活动期间，邀请好友人数超过10人者，即可领取新年福袋一个。打开福袋，把梦想娃娃领回家。<br/><br/>背包里的福袋不单独发货哦！！</div>
                            </div>
                            <div class="item">
                                <div class="title other">活动规则</div>
                                <div class="info">所有红包于活动结束后三个工作日内发放到账户，请耐心等待。</div>
                                <div class="info">在充值购买金币时可以直接使用；使用期限为红包到账后的7天内。</div>
                                <div class="info">严禁所有“刷好友”行为，一经查出，取消活动资格并清除所有好友个数！</div>
                            </div>
                            <div class="intro">活动最终解释权归梦想抓娃娃所有。</div>
                            <a href="javascript:;" onclick="goShare()" class="btn"><img src="src/img/invitationrank_btn.png"></a>
                        </div>
                    </div>
                    <div class="bgbottom"></div>
                </div>
                <div class="invitationrank_rank">
                    <div class="bgtop"></div>
                    <div class="bgcenter">
                        <div class="invitationrank_rank_content">
                            <div class="title"><span>我的邀请人数</span><span class="fr selfnum">0人</span></div>
                            <div class="invitationrank_list">
                                <div class="tab"><span>排名</span><label class="fr">邀请人数</label></div>
                                <div id="invitationranklist">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="bgbottom"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="init_loading">
        <img src="src/img/page_loading.gif">
    </div>
</body>
<script type="text/javascript" src="src/js/jquery-1.10.1.min.js?__version=3.4"></script>
<script type="text/javascript" src="src/js/rem.js?__version=3.4"></script>
<script type="text/javascript" src="src/js/dropload.js?__version=3.4"></script>
<script type="text/javascript" src="src/js/init.js?__version=3.4"></script>

<script type="text/javascript">
    var u = navigator.userAgent, app = navigator.appVersion;
    var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
    var isapp=getQueryString('isapp');
    if(isapp=="1"){
        var token=getQueryString('token');
    }
    console.log(isapp)
    if(isapp!="1"){
        addheader("邀请排行榜","/");
        $(".invitationrank_activity_cont .btn").attr("href","/invitation.html")
    }else{
        $('.invitationrank-warp').css("padding-top","0")
    }
    function goShare(){
      if(isapp=="1"){
        if(isIOS){
          window.webkit.messageHandlers.myapp.postMessage("goShare");
        }else{
         myapp.goShare();
        }
      }
    }
    inviterRankingList();
    function  inviterRankingList(){
        $.ajax({
            type:'get',
            url:api_url+'/OpenAPI/V1/User/inviterRankingList',
            jsonp:'callback',
            dataType:'jsonp',
            data:{token:token},
            success:function(res){
                console.log(res)
                $(".invitationrank_rank_content .title .selfnum").html(res.data.personal.num+"人");
                var html="";
                var list=res.data.list;
                console.log(list)
                for(var i=0;i<list.length;i++){
                    if(i==0){
                        html+='<div class="item">'
                                +'<span><img src="src/img/invitationrank1.png"/>'+list[i]['nickname']+'</span><label class="fr" style="color:#e59517;">'+list[i]['num']+'人</label>'
                              +'</div>';
                    }else if(i==1){
                        html+='<div class="item">'
                                +'<span><img src="src/img/invitationrank2.png"/>'+list[i]['nickname']+'</span><label class="fr" style="color:#bf6f45;">'+list[i]['num']+'人</label>'
                              +'</div>';
                    }else if(i==2){
                        html+='<div class="item">'
                                +'<span><img src="src/img/invitationrank3.png"/>'+list[i]['nickname']+'</span><label class="fr" style="color:#b1aeae;">'+list[i]['num']+'人</label>'
                              +'</div>';
                    }else{
                        html+='<div class="item">'
                                +'<span><small>'+(i+1)+'</small>'+list[i]['nickname']+'</span><label class="fr">'+list[i]['num']+'人</label>'
                              +'</div>';
                    }
                    
                }
                $('#invitationranklist').html(html);
            }
        })
    }
</script>

</html>